home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / NeoIntroPP3.0 folder / PowerPlant / NeoBench / Includes / CIDIndex.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-12  |  1.9 KB  |  68 lines  |  [TEXT/KAHL]

  1. /************************************************************
  2.  *
  3.  *    Created: Sunday, January 20, 1991 4:11:08 PM
  4.  *    CIDIndex.h
  5.  *    C++ class definition for index objects
  6.  *
  7.  *
  8.  *    Copyright Neologic Systems 1992
  9.  *    All rights reserved
  10.  *
  11.  *
  12.  * Within a class, references to permanent objects are kept in a sorted list called a
  13.  * index. The default sorting order in an index is ascending by ID value, however
  14.  * other sorting orders are possible. The class CIDIndex implements a sample
  15.  * secondary index.
  16.  *
  17.  ***********************************************************/
  18. #pragma once            /* Include this file only once */
  19. #ifndef __CIDIndex__
  20. #define __CIDIndex__ 1
  21.  
  22. #include "NeoTypes.h"
  23. #include CNeoNodeH
  24.  
  25. const NeoID kIDIndexID    = 17;
  26.  
  27. typedef struct {
  28.     NeoID                fID;                    // identity of the object this entry refers to
  29. } IDIndexEntry;
  30.  
  31. class CIDIndex : public CNeoNode {
  32. public:
  33.                         /** Instance Methods **/
  34.                         CIDIndex(const short aCount, CNeoNode *aParent, const NeoID aID);
  35. #ifdef qMacApp
  36.     virtual                ~CIDIndex(void);
  37. #endif
  38.     static CNeoPersist *New(void);
  39.     virtual NeoID        getClassID(void) const;
  40.     virtual long        getFileLength(void) const;
  41.  
  42.                         /** I/O Methods **/
  43.     virtual void        readObject(CNeoStream *aStream, const NeoTag aTag);
  44.     virtual void        writeObject(CNeoStream *aStream, const NeoTag aTag);
  45.  
  46.                         /** Object List Management Methods **/
  47.     virtual CNeoPersist *
  48.                         getObject(const short aIndex);
  49.     virtual CNeoNode *    insertObject(const short aIndex, CNeoPersist *aObject);
  50.     static void *        KeyManager(const NeoKeyOp aOp, ...);
  51.  
  52.                         /** Entry Methods **/
  53.     virtual short        getEntrySize(void) const;
  54.  
  55. protected:
  56. #ifdef qNeoDebug
  57.                         /** Debugging Methods **/
  58.     virtual const void *verify(const void *aValue) const;
  59. #endif
  60.  
  61.                         /** Instance Variables **/
  62. public:
  63.     IDIndexEntry        fEntry[kNeoDefaultNodeEntryCount];            // references to objects in the list
  64. };
  65.  
  66. enum {kIDIndexFileLength    = (kNeoNodeFileLength + (sizeof(IDIndexEntry) * kNeoDefaultNodeEntryCount))};
  67. #endif
  68.